#include <assert.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

#include "lex.h"

void lexer_load_code(Lexer* this, const char* src) {
  FILE* fp = fopen(src, "rb");
  assert(fp);

  int r = fseek(fp, 0, SEEK_END);
  assert(r);

  int size = ftell(fp);
  rewind(fp);
  assert(size < sizeof(this->code));

  fread(this->code, 1, size, fp);
  this->code_size = size;
  fclose(fp);
}

void lexer_parse_one_token(Lexer* this) {
}

void lexer_tokenize(Lexer* this) {
  while (true) {
    lexer_parse_one_token(this);
    if (this->has_error) {
      break;
    }
    if (this->is_done){
      break;
    }
  }
}
